# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-pydantic-core
pkgver=2.16.3
pkgrel=1
pkgdesc="Core validation logic for pydantic written in rust"
url="https://github.com/pydantic/pydantic-core"
arch="all"
license="MIT"
depends="py3-typing-extensions"
makedepends="py3-gpep517 py3-maturin py3-wheel py3-installer cargo"
checkdepends="
	py3-pytest
	py3-pytest-benchmark
	py3-pytest-mock
	py3-pytest-timeout
	py3-hypothesis
	py3-dirty-equals
	"
subpackages="$pkgname-pyc"
source="https://github.com/pydantic/pydantic-core/archive/refs/tags/v$pkgver/py3-pydantic-core-$pkgver.tar.gz"
builddir="$srcdir/pydantic-core-$pkgver"

prepare() {
	default_prepare
	cargo fetch --locked
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--config-json '{"build-args": "--frozen"}' \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
bcc1c8cc53f72934af6d5d570b6c8ade1dbb96e475f4899aa82436babee68fb9e7c805c373075207402bf0ad9b1c9d756b068ab05aa088ec876abf2a6d34d0aa  py3-pydantic-core-2.16.3.tar.gz
"
